
#chat_app {
    height: calc(100vh - 50px);
}

.preview-section #chat_app{
    height: calc(100vh - 200px);
}

h1, h2, h3, h4, h5, h6 {
    font-size: revert;
    font-weight: revert;
}

/* 消息容器布局 */
.message-container {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
    gap: 10px;
}

/* 用户消息靠右 */
.user-message-container {
    flex-direction: row-reverse;
}

/* 机器人消息靠左 */
.bot-message-container {
    flex-direction: row;
}

/* 头像样式 */
.message-container > .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: solid 1px #eee;
}

.message-container > .avatar > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    padding: 4px;
    box-sizing: border-box;
}

/* 消息气泡样式 */
.message-container .message {
    max-width: 70%;
    padding: 10px 15px;
    box-sizing: border-box;
    border-radius: 18px;
    line-height: 1.4;
}

.bot-message-container .message {
    background: #f0f0f0;
    color: #333;
    border-top-left-radius: 4px;
    justify-content: flex-start;
}

.user-message-container .message {
    background: #1890ff;
    color: white;
    margin-left: auto;
    border-top-right-radius: 4px;
}

.user-message-container .message:has(img) {
    background: initial;
}

.bot-message-container .message .message-content {
    border-radius: 18px;
    word-break: break-word;
}

/* 分析中... */
.analyze-msg .message-content {
    position: relative;
    display: inline-block;
    padding-right: 20px;
}

.analyze-msg .message-content::after {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    content: "";
    display: inline-block;
    animation: ellipsis 2s infinite;
    width: 15px;
}

@keyframes ellipsis {
    0% {
        content: "";
    }
    33% {
        content: ".";
    }
    66% {
        content: "..";
    }
    100% {
        content: "...";
    }
}

/* 开场问题样式 */
.opening-questions-container {
    width: 100%;
    margin-top: 12px;
    padding-left: 50px; /* 与机器人消息对齐 */
}

.opening-questions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.opening-question-item {
    display: inline-flex;
    align-items: center;
    background: #f0f8ff;
    border: 1px solid #4299e1;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #2b6cb0;
    user-select: none;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.opening-question-item:hover {
    background: #4299e1;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .opening-questions-container {
        padding-left: 50px;
    }
    
    .opening-question-item {
        font-size: 13px;
        padding: 6px 12px;
        max-width: 150px;
    }
}

.html-content p{
    white-space: pre-wrap; /* 同时保留回车、换行和空格，并且文本会自动换行，是最常用的保留原始格式的方案。 */
    /*white-space: pre-line; !*保留回车和换行（即文本中的换行效果），但会将多个连续空格合并为一个，同时文本会根据容器宽度自动换行。*!*/
}

/* 欢迎语链接特殊样式 - 简洁风格 */
.welcome-msg-link {
    color: #1890ff !important;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline;
    border-bottom: 1px dashed #1890ff;
    padding: 0 2px;
    position: relative;
    word-break: break-word;
    cursor: pointer;
}

.welcome-msg-link:hover {
    color: #40a9ff !important;
    text-decoration: none;
    border-bottom: 1px solid #40a9ff;
    background: rgba(24, 144, 255, 0.05);
}

.welcome-msg-link:active {
    color: #096dd9 !important;
}

/* 简洁的外部链接图标 */
.welcome-msg-link:after {
    content: "↗";
    font-size: 10px;
    color: #1890ff;
    margin-left: 2px;
    opacity: 0.7;
    vertical-align: super;
    transition: opacity 0.2s ease;
}

.welcome-msg-link:hover:after {
    opacity: 1;
    color: #40a9ff;
}

/* 普通聊天消息中的链接样式 - 更加自然融入对话 */
.chat-msg-link {
    color: #1890ff !important;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    transition: all 0.2s ease;
    display: inline;
    padding: 0 1px;
    border-radius: 2px;
    word-break: break-word;
    cursor: pointer;
}

.chat-msg-link:hover {
    color: #40a9ff !important;
    text-decoration: underline;
    text-decoration-style: solid;
    background: rgba(24, 144, 255, 0.08);
}

.chat-msg-link:active {
    color: #096dd9 !important;
}

/* 聊天消息链接的外部链接图标 - 更小更低调 */
.chat-msg-link:after {
    content: "↗";
    font-size: 9px;
    color: #1890ff;
    margin-left: 1px;
    opacity: 0.6;
    vertical-align: super;
    transition: opacity 0.2s ease;
}

.chat-msg-link:hover:after {
    opacity: 0.9;
    color: #40a9ff;
}

/* 在用户消息中的链接样式调整 */
.user-message-container .chat-msg-link {
    color: #ffffff !important;
    text-decoration-color: rgba(255, 255, 255, 0.8);
}

.user-message-container .chat-msg-link:hover {
    color: #ffffff !important;
    text-decoration-color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, 0.15);
}

.user-message-container .chat-msg-link:after {
    color: #ffffff;
    opacity: 0.7;
}

.user-message-container .chat-msg-link:hover:after {
    opacity: 1;
    color: #ffffff;
}

/* 确保链接样式在所有容器中正确显示 */
.html-content a.welcome-msg-link,
.html-content a.chat-msg-link {
    color: inherit !important;
    text-decoration: inherit !important;
    font-weight: inherit !important;
    border-bottom: inherit !important;
}

/* 确保在Markdown渲染后链接样式不被覆盖 */
.message-content a[target="_blank"] {
    position: relative;
    z-index: 1;
}

/* 防止链接样式被其他CSS规则覆盖 */
.welcome-msg-link,
.chat-msg-link {
    text-decoration-line: inherit !important;
}

/* 响应式处理 */
@media (max-width: 768px) {
    .welcome-msg-link {
        word-break: break-all;
    }
    
    .welcome-msg-link:after {
        font-size: 9px;
        margin-left: 1px;
    }
    
    .chat-msg-link {
        word-break: break-all;
    }
    
    .chat-msg-link:after {
        font-size: 8px;
        margin-left: 1px;
    }
}

/* ========== Markdown 元素样式 ========== */
.html-content h1, .html-content h2, .html-content h3, 
.html-content h4, .html-content h5, .html-content h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    line-height: 1.25;
    border-bottom: none;
}

.html-content h1 { font-size: 1.5em; color: #2c3e50; }
.html-content h2 { font-size: 1.3em; color: #34495e; }
.html-content h3 { font-size: 1.15em; color: #34495e; }
.html-content h4 { font-size: 1.05em; color: #34495e; }
.html-content h5 { font-size: 1em; color: #34495e; }
.html-content h6 { font-size: 0.95em; color: #7f8c8d; }

/* 代码块样式 */
.html-content code {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: #e74c3c;
}

.html-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
    overflow-x: auto;
    line-height: 1.4;
}

.html-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #2c3e50;
    font-size: 0.9em;
}

/* 列表样式 */
.html-content ul, .html-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.html-content li {
    margin: 4px 0;
    line-height: 1.5;
}

.html-content ul li {
    list-style-type: disc;
}

.html-content ol li {
    list-style-type: decimal;
}

/* 引用样式 */
.html-content blockquote {
    border-left: 4px solid #3498db;
    background-color: #f8f9fa;
    margin: 12px 0;
    padding: 8px 16px;
    color: #555;
    font-style: italic;
}

.html-content blockquote p {
    margin: 0;
}

/* 表格样式 */
.html-content table {
    border-collapse: collapse;
    margin: 12px 0;
    width: 100%;
    background-color: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.html-content table th,
.html-content table td {
    border: 1px solid #e9ecef;
    padding: 8px 12px;
    text-align: left;
}

.html-content table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.html-content table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.html-content table tr:hover {
    background-color: #e3f2fd;
}

/* 分隔线样式 */
.html-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #bdc3c7, transparent);
    margin: 20px 0;
}

/* 删除线样式 */
.html-content del {
    text-decoration: line-through;
    color: #7f8c8d;
    opacity: 0.8;
}

/* 图片样式 */
.html-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 强调样式 */
.html-content strong {
    font-weight: 600;
    color: #2c3e50;
}

.html-content em {
    font-style: italic;
    color: #34495e;
}

/* 用户消息中的markdown样式调整 */
.user-message-container .html-content h1,
.user-message-container .html-content h2,
.user-message-container .html-content h3,
.user-message-container .html-content h4,
.user-message-container .html-content h5,
.user-message-container .html-content h6 {
    color: #ffffff;
}

.user-message-container .html-content code {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.user-message-container .html-content pre {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.user-message-container .html-content pre code {
    color: #ffffff;
}

.user-message-container .html-content blockquote {
    border-left-color: rgba(255, 255, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.user-message-container .html-content strong {
    color: #ffffff;
}

.user-message-container .html-content em {
    color: rgba(255, 255, 255, 0.9);
}

.user-message-container .html-content table th {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.user-message-container .html-content table td {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

/* 响应式Markdown样式 */
@media (max-width: 768px) {
    .html-content table {
        font-size: 0.9em;
    }
    
    .html-content pre {
        padding: 8px;
        font-size: 0.85em;
    }
    
    .html-content h1 { font-size: 1.3em; }
    .html-content h2 { font-size: 1.2em; }
    .html-content h3 { font-size: 1.1em; }
}


/* 上传区域样式 */
.upload-area {
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: 0 !important;
}

/* 文件预览样式 */
#filePreview {
    max-height: 150px;
    overflow-y: auto;
}


.chat-footer .chat-input {
    padding: 0 15px;
    height: 70px;
    background-color: white;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
}

.chat-footer .chat-input .message-input {
    flex-grow: 1;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    resize: none;
    min-height: 40px;
    max-height: 120px;
}

.chat-footer .chat-input .send-button {
    margin-left: 10px;
    background-color: #0066ff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.chat-footer .chat-input .voice-button {
    margin-left: 10px;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex
;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}




